<template>
 <div class="question">
     <el-header>{{meeting.name}}会议自由提问</el-header>
    <el-input
        type="textarea"
        :rows="5"
        placeholder="请提出问题"
        v-model="textarea">
        </el-input>
    <div class="foot">
        <el-button type="primary" @click="submitQuestion">提交</el-button>
    </div>

 </div>
</template>

<script>
export default {
    name: 'Question',
    data() {
        return {
            meeting:{
                name:'',
                id:''
            },
            textarea: ''
        }
    },
    methods:{
        initMeetingData(){
           this.meeting.id =  this.$route.params.meetingId;
        },
        submitQuestion(){
            if(this.textarea==''){
                this.$notify.error({
                    title: '提示',
                    message: '内容不能为空'
                });
            }else{
                this.axios.post('/question/',{
                    "meetingId":this.meeting.id,
                    "content":this.textarea,
                }).then((res)=>{
                    if(res.data){
                        this.textarea='';
                        this.$notify({
                            title: '成功',
                            message: '提问成功',
                            type: 'success'
                        });
                    }
                }).catch((err)=>{
                    console.log(err);
                })
            }
            
        },
        findMeetingDataById(id){
            this.axios.get('/meeting/'+this.meeting.id).then((res)=>{
                this.meeting=res.data;
            }).catch((err)=>{
                console.log(err);
            })
        }

    },
    mounted(){
        this.initMeetingData();
    }
}
</script>

<style scoped>
    .question{
        width: 50%;
        margin: 0 auto;
    }
    .foot{
        margin-top: 30px;
        display: flex;
        justify-items: flex-start
    }
</style>
